package com.icode.core.model.user;

import com.icode.core.model.AbstractEntity;
import com.icode.core.shared.PrivilegesUserType;
import org.hibernate.annotations.TypeDef;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created with IntelliJ IDEA.
 * User: ZhongGang
 * Date: 15-1-7
 * Time: 下午10:41
 */
@Entity
@Table(name="role")
@TypeDef(name = "Privileges", typeClass = PrivilegesUserType.class, defaultForType = Privileges.class)
public class Role extends AbstractEntity {
    @Column
    private String name;

    @Column(name = "privileges")
    private Privileges privileges = new Privileges();

    public Role() {
    }

    public Role(String name, Privileges privileges) {
        this.name = name;
        this.privileges = privileges;
    }

    public String getName() {
        return name;
    }

    public Privileges getPrivileges() {
        return privileges;
    }
}
